/*
 * $Id: LogSender.java,v 1.3 2009/08/20 19:38:42 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.dbLogger;

import org.springframework.jms.core.JmsTemplate;

import com.ge.healthcare.autosc.common.ASCLogger;
import com.ge.healthcare.autosc.common.database.pojo.HstStepTime;
import com.ge.healthcare.autosc.common.database.pojo.HstSystemContactInfo;

/**
 * @author 212042764
 * 
 */
public class LogSender implements ILogSender {
	private JmsTemplate dbLoggerJmsTemplate = null;
	private JmsTemplate dbLoggerJmsTemplateForContactLog = null;
	/**
	 * Spring likes me
	 */
	public LogSender() {
		super();
	}

	/**
	 * @see com.ge.healthcare.autosc.common.dbLogger.ILogSender#sendStepTimeLog(com.ge.healthcare.autosc.common.database.pojo.HstStepTime)
	 */
	public void sendStepTimeLog(HstStepTime stepTime) {
		String methodName = "sendStepTimeLog";
		if(dbLoggerJmsTemplate == null) {
			ASCLogger.info(StepLogger.class, methodName, "dbLoggerJmsTemplate is null");
		}else{
			dbLoggerJmsTemplate.convertAndSend(stepTime);
			ASCLogger.info(StepLogger.class, methodName, "Sent stepTime:"
					+ stepTime);
		}
		ASCLogger.debug(StepLogger.class, methodName,
				"Leaving.. JMS Message sent");
	}

	public void sendSystemContactInfoLog(HstSystemContactInfo systemContactInfo) {
		String methodName = "sendSystemContactInfoLog";
		dbLoggerJmsTemplateForContactLog.convertAndSend(systemContactInfo);
		ASCLogger.info(ContactLogger.class, methodName, "Sent HstSystemContactInfo:"
				+ systemContactInfo);
		ASCLogger.debug(ContactLogger.class, methodName,
				"Leaving.. JMS Message for HstSystemContactInfo was sent");
	}
	
	/**
	 * @param dbLoggerJmsTemplate
	 *            the dbLoggerJmsTemplate to set
	 */
	public void setDbLoggerJmsTemplate(JmsTemplate dbLoggerJmsTemplate) {
		this.dbLoggerJmsTemplate = dbLoggerJmsTemplate;
	}
	
	/**
	 * @param dbLoggerJmsTemplate
	 *            the dbLoggerJmsTemplateForContactLog to set
	 */
	public void setDbLoggerJmsTemplateForContactLog(JmsTemplate dbLoggerJmsTemplate) {
		this.dbLoggerJmsTemplateForContactLog = dbLoggerJmsTemplate;
	}
}
